Suponiendo que la URL proporcionada es incorrecta, el módulo Got genera un HTTPError, ¿cómo detecto el error? Intenta atrapar no funciona
const got = require('got'); got(`https://www.wrongurl.com`) .then(response => { //do stuff })yo usaría
got(...).then( response => { /* handle good response here */}, error => { /* handle error here */ } ) Simple .catch(() => { ... }) puede detectar un error en .then(response... parte también, eso no es lo que espera.
Consulte también https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then como referencia.